<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"   
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:ace="http://www.icefaces.org/icefaces/components"
   xmlns:icecore="http://www.icefaces.org/icefaces/core">
   <h:body> 
      <ui:composition template="/WEB-INF/templates/adminuser/template.xhtml">
         <ui:define name="content">
         
		<f:event type="preRenderView" listener="#{userInfoBean.forwardUsersIfNotSelection}"/>
         
              <h:form id="form-users">
              
              		<icecore:singleSubmit />
              
		            <ace:panel     closable  = "false"
			                       toggleable= "false"
			                       collapsed = "false" >
			       		<h:panelGrid  columns="2"  style="margin-left:auto; margin-right:auto;">
				            <h:outputText   value="#{msgs['userdata.name']}"/>
				            <h:inputText    value="#{userInfoBean.selectedUser.name}" /> 
				            <h:outputText   value="#{msgs['userdata.password']}"/>
				            <h:inputText    value="#{userInfoBean.selectedUser.pass}" /> 
				        </h:panelGrid>
				        <h:commandButton  id="saveBttn" value="#{msgs['userdata.saveChanges']}" 
	                                         actionListener="#{userInfoBean.selectedUser.saveChanges}"
	                                         action="users"/>
		            </ace:panel>
		            
		            <ace:dataTable id="usr-dev-list" value="#{userInfoBean.selectedUser.userDevices}" var="dev">
                      		<ace:column id="dev-list-check-col">
	                          		<ace:checkboxButton id="check-row" value="#{dev.selected}"/>
                      		</ace:column>  
	                      	<ace:column id="dev-list-name-col" headerText="#{msgs['userdata.devname']}">
	                           	<h:outputText id="dev-row" value="#{dev.name}"/>
	                      	</ace:column>
	                      	<ace:column id="dev-list-type-col" headerText="#{msgs['userdata.devtype']}">
	                           	<h:outputText id="type-row" value="#{dev.typename}"/>
	                      	</ace:column>  
               		</ace:dataTable>  
		                  		
	           </h:form>
	       </ui:define>		
      </ui:composition> 
   </h:body> 
</html>	